<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>渲染柱形图</title>
    <style>
        .box {
            background-color: #f2f2f2;
            height: 300px;
            width: 700px;
            border-bottom: 1px solid rgb(180, 178, 178);
            border-left: 1px solid rgb(180, 178, 178);
            display: flex;
            justify-content: space-around;
            align-items: flex-end;
            margin: 50px auto;
            text-align: center;
        }

        .box>div {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            width: 50px;
            background-color: #969393;
        }

        span {
            display: inline-block;
            margin-top: -20px;
        }

        h4 {
            margin-bottom: -30px;
            width: 70px;
            margin-left: -10px;
        }
    </style>
</head>

<body>

    <script>
        let arr = []
        for (let i = 0; i < 4; i++) {
            arr.push(prompt(`请输入${i + 1}季度的数据：`))
        }

        document.write(`<div class="box">`)

        for (let index = 0; index < arr.length; index++) {
            document.write(`
                <div style="height: ${arr[index]}px;"><span>${arr[index]}</span>
                    <h4>第${index + 1}季度</h4>
                </div>
            `)
        }

        document.write(`</div>`)
    </script>
</body>

</html>